﻿// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone

using BlazorAdmin.Models;
using BootstrapBlazor.Components;
using System.Collections.Generic;

namespace BlazorAdmin.Interface
{
    /// <summary>
    /// Dict 字典表接口
    /// </summary>
    public interface IDict
    {
        List<SelectedItem> GetByCategory(string category);

        Dictionary<string, List<Dict>> GetByCategories(string categories);

        List<Dict> GetAll();

        /// <summary>
        /// 获得 配置所有的 App 集合
        /// </summary>
        /// <returns></returns>
        Dictionary<string, string> GetApps();

        /// <summary>
        /// 获得 Cookie 登录持久化时长
        /// </summary>
        /// <returns></returns>
        int GetCookieExpiresPeriod();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="expiresPeriod"></param>
        /// <returns></returns>
        bool SaveCookieExpiresPeriod(int expiresPeriod);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        string GetProfileUrl(string appId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        string GetSettingsUrl(string appId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        string GetNotificationUrl(string appId);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        string GetIconFolderPath();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        string GetDefaultIcon();

        /// <summary>
        /// 通过指定 appId 获得配置首页地址
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        string GetHomeUrlByAppId(string appId);

        /// <summary>
        /// 是否开启自动锁屏设置
        /// </summary>
        /// <returns></returns>
        bool GetAutoLockScreen();

        /// <summary>
        /// 保存自动锁屏设置
        /// </summary>
        /// <returns></returns>
        bool SaveAutoLockScreen(bool value);

        /// <summary>
        /// 获得自动锁屏间隔时间
        /// </summary>
        /// <returns></returns>
        int GetAutoLockScreenInterval();

        /// <summary>
        /// 保存自动锁屏间隔时间
        /// </summary>
        /// <returns></returns>
        bool SaveAutoLockScreenInterval(int value);

        /// <summary>
        /// 获得 Cookie 过期时间
        /// </summary>
        /// <returns></returns>
        int GetCookieExpired();

        /// <summary>
        /// 设置 Cookie 过期时间
        /// </summary>
        /// <returns></returns>
        bool SaveCookieExpired(int value);

        /// <summary>
        /// 获得程序异常保留时长
        /// </summary>
        /// <returns></returns>
        int GetExceptionExpired();

        /// <summary>
        /// 设置程序异常保留时长
        /// </summary>
        /// <returns></returns>
        bool SaveExceptionExpired(int value);

        /// <summary>
        /// 获得操作日志保留时长
        /// </summary>
        /// <returns></returns>
        int GetOperateExpired();

        /// <summary>
        /// 设置操作日志保留时长
        /// </summary>
        /// <returns></returns>
        bool SaveOperateExpired(int value);

        /// <summary>
        /// 获得登录日志保留时长
        /// </summary>
        /// <returns></returns>
        int GetLoginExpired();

        /// <summary>
        /// 设置登录日志保留时长
        /// </summary>
        /// <returns></returns>
        bool SaveLoginExpired(int value);

        /// <summary>
        /// 获得访问日志保留时长
        /// </summary>
        /// <returns></returns>
        int GetAccessExpired();

        /// <summary>
        /// 设置访问日志保留时长
        /// </summary>
        /// <returns></returns>
        bool SaveAccessExpired(int value);

        /// <summary>
        /// 获得 IP 请求缓存时长
        /// </summary>
        /// <returns></returns>
        int GetIPCacheExpired();

        /// <summary>
        /// 设置 IP 请求缓存时长
        /// </summary>
        /// <returns></returns>
        bool SaveIPCacheExpired(int value);
        /// <summary>
        /// 获得前台应用
        /// </summary>
        /// <returns></returns>
        List<ClientApp> GetClients();
        /// <summary>
        /// 获得前台应用
        /// </summary>
        /// <returns></returns>
        bool ExistsAppId(string appId);

        /// <summary>
        /// 添加前台应用
        /// </summary>
        /// <returns></returns>
        bool SaveClient(ClientApp client);

        /// <summary>
        /// 获得前台应用配置
        /// </summary>
        /// <returns></returns>
        ClientApp GetClient(string appId);

        /// <summary>
        /// 删除前台应用配置
        /// </summary>
        /// <returns></returns>
        bool DeleteClient(string appId);

        /// <summary>
        /// 插入或更新字典数据
        /// </summary>
        /// <param name="dicts"></param>
        /// <returns></returns>
        bool SaveDicts(List<Dict> insertDicts, List<Dict> updateDicts);
    }
}